<template>
  <div>
    <RouterView />
    <van-tabbar route active-color="#24C874" class="tabbar">
      <van-tabbar-item
        to="/trends"
        class="iconfont icon-shouye"
        style="font-size: 15px"
        >首页</van-tabbar-item
      >
      <van-tabbar-item
        to="/schoolRun"
        class="iconfont icon-paobu"
        style="font-size: 15px"
        >校园跑</van-tabbar-item
      >
      <van-tabbar-item
        to="/massage"
        class="iconfont icon-xiaoxi"
        style="font-size: 15px"
        >消息</van-tabbar-item
      >
      <van-tabbar-item
        to="/my"
        class="iconfont icon-icon-test"
        style="font-size: 15px"
        >我的</van-tabbar-item
      >
    </van-tabbar>
  </div>
</template>

<script setup>
import axios, { fetchData } from "../utils/request";
import { onMounted, onUnmounted } from "vue";
import { useRouter } from "vue-router";
const router = useRouter();
const getlist = async () => {
  const data = await fetchData("/profile");
  if (!data) {
    router.push("/login/zh");
  }
};
let intervalId;
onMounted(() => {
  getlist();
  intervalId = setInterval(getlist, 2 * 1000);
});

onUnmounted(() => {
  clearInterval(intervalId);
});
</script>

<style scoped lang="scss"></style>
